/**
 * 
 */
package net.toocruel.iqismart.service.core.impl;


import net.toocruel.iqismart.dao.core.*;
import net.toocruel.iqismart.entity.core.Exchange;
import net.toocruel.iqismart.service.core.ExchangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author toocruel
 *
 */
@Service
@Transactional
public class ExchangeServiceImpl implements ExchangeService {
    @Autowired
    private TagRepository tagRepository;

    @Autowired
    private CategoryRepository categoryRepository;

    @Autowired
    private SupportRepository supportRepository;

    @Autowired
    private QuestionRepository questionRepository;

    @Autowired
    private AnswerRepository answerRepository;

    @Autowired
    private CommentRepository commentRepository;

    @Autowired
    private ArticleRepository articleRepository;

    @Autowired
    private ExchangeRepository exchangeRepository;


    @Override
    public Page<Exchange> findALl(Long id, PageRequest pageRequest) {
        return exchangeRepository.findAll((root, query, cb) -> cb.equal(root.get("user"),id),pageRequest);
    }
}
